#!/usr/bin/env python
# coding=utf-8


from PySide6.QtCore import Qt
from PySide6.QtWidgets import QHBoxLayout, QLabel, QWidget


class MaskWidget(QWidget):
    def __init__(self, parent: QWidget = None, info: str = None):
        super().__init__(parent)
        self.init_ui(info)

    def init_ui(self, info: str = None):
        #  layout required
        layout = QHBoxLayout(self)
        label = QLabel(info if info is not None else "", self)
        label.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.setWindowModality(Qt.WindowModality.WindowModal)
        self.hide_mask()
        layout.addWidget(label)

    def show_mask(self):
        self.resize(self.parent().size())
        self.show()

    def hide_mask(self):
        self.hide()
